package com.itheima.mapper;

import com.itheima.entity.Student;
import com.itheima.entity.StudentQueryParam;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper {

    @Select("select count(*) from student where clazz_id = #{id}")
    Integer countByClazzId(Integer id);


    List<Student> list(StudentQueryParam studentQueryParam);

    void save(Student student);

    @Select("select * from student where id = #{id}")
    Student getInfo(Integer id);

    void update(Student student);

    void deleteByIds(List<Integer> ids);

    @Update("update student set violation_count = violation_count + 1, violation_score = violation_score + #{score} where id = #{id}")
    void updateScore(Integer id, Short score);
    @MapKey("cname")
    List<Map<String, Object>> countStudentData();

//    @MapKey("name")
//    List<Map<String, Object>> getStudentDegreeData();

    @MapKey("name")
    List<Map> countStudentDegreeData();
}
